﻿<?php
@session_start();
require_once("../../class/mysql.class.php");

if ((isset($_GET["action"])) && ($_GET["action"] == "update"))
{           
                        
                  $obj = new Mysql();
  
  $obj -> set_table('user_login');
  $obj -> set_colone("(`*`)");
  $obj -> set_variables(" id_login = '" . $_SESSION["id"] . "' ");
  $user = $obj -> select_enregistrement();
  echo $user['id_login'];

	$id = $_REQUEST["id_type"]; 
        $type = addslashes($_REQUEST["type_article"]); 
	$desc = addslashes($_REQUEST["desc_article"]); 
	echo  $sql = "UPDATE `st_att_type_article` SET `description`='".$desc."'  WHERE id_type=".$id;
	$obj = new Mysql ();
	mysql_query($sql);
      header('location:../../list_type_articles.php?action=updated&type='.$type);	
}

elseif ((isset($_GET["action"])) && ($_GET["action"] == "delete"))
{

      if (empty($_GET['id_type'])) 
      {
        header("Location:../user.php?action=error");
      } else 
      {
      $obj = new Mysql ();
      $requte="DELETE FROM `st_att_type_article` WHERE `id_type`='".$_GET["id_type"]."'";
      $resultat=mysql_query($requte);
      header('location:../../list_type_articles.php?action=deleted');         
      }                 
      

}

?>